package com.momoauth.api_client.entity;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;

@Data
@DS("momo_auth")
@JsonIgnoreProperties(value = {"password","salt"}) //忽略属性
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User {
    @TableId(value = "userId", type = IdType.ASSIGN_ID)
    private Long userId;
    @NotEmpty(message="用户名不能为空！")
    private String username; //用户名
    @NotEmpty(message="密码不能为空！")
    @Length(min = 6, max = 10, message = "密码长度必须位于6到10位之间")
    private String password; //密码
    private String salt; //盐值
    private String realName; //真实名称
    private Long dept_id; //部门ID
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private String createTime; //创建时间
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Long version; //版本号
    @TableField(fill = FieldFill.UPDATE)
    private String updateTime; //修改时间
    private Integer status; //状态 1.启用 2.禁用
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Integer isDelete; //是否删除 0.否 1.是
    @TableField(exist = false)
    private Integer currentPage; //页码
    @TableField(exist = false)
    private Long pageSize; //计数
    @TableField(exist = false)
    private Long role_id; //角色ID
    @TableField(exist = false)
    private Long id; //指代用户角色/群组的主键ID
    @TableField(exist = false)
    private String deptName; //部门名称
    @TableField(exist = false)
    private String keywords; //关键词
}
